home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor1 / music.doc < prev    next >
Text File  |  1995-03-31  |  8KB  |  140 lines

  1.                               MUSIC.DOC file 
  2.                               by Jeff Broido 
  3.  
  4.                Copyright 1990 by Broido Computer Consulting. 
  5.                 All rights reserved.  The right is granted 
  6.                     to anyone to copy these materials, 
  7.                         but they must not be sold. 
  8.  
  9.  
  10. OVERVIEW 
  11. -------- 
  12.  
  13. The MUSIC application allows the user to play simple non-polyphonic themes  
  14. on the HP48SX calculator.  Several sample melodies are included, and any  
  15. user with a rudimentary knowledge of music can add more.  While the song is 
  16. playing, the title, key and optional rolling text are displayed. 
  17.  
  18. This system was developed on an HP28S.  If there is any interest in the  
  19. original version (which is only slightly different), please attach a  
  20. response.  Note that the HP28S, although slower and less able to play  
  21. themes up to tempo as a result, has a cleaner tone transducer.  The 28  
  22. sounds like a flute; the 48, though I dearly love it, sounds to me like a  
  23. diseased duck. 
  24.  
  25. PROCEDURE 
  26. --------- 
  27.  
  28.  1. Using Kermit, load MUSIC into any HP48SX directory.  the MUSIC  
  29.     directory will appear as a sub-directory of whatever directory is  
  30.     current when the file is transferred.  For your reference, the BYTES  
  31.     command yields a checksum of # FF77h and a size of 10837 bytes. 
  32.  
  33.  2. Press [MUSIC] to switch to the new sub-directory. 
  34.  
  35.  3. Enter a number from 0 to 10 and press [PLAY].  The title, key and  
  36.     optional information will appear as the song is playing. 
  37.  
  38.  4. To stop a song while it is playing, hold down the enter key long enough 
  39.     so that it is still depressed at the transition point between any two  
  40.     notes.   
  41.  
  42.  5. To make a song repeat endlessly, hold down the R (for repeat) key (the  
  43.     right arrow) until "Repeat Mode." appears on the third line of the  
  44.     display.  To cancel repeat mode, hold down R again and the song will  
  45.     end at its normal point.  Don't hold down R too long in any case, or  
  46.     the calculator will make a strangled, gargling noise. 
  47.  
  48.  6. To get a listing of the songs in your MUSIC directory, hit the [CAT]  
  49.     key.  This takes a while, and formats the list in the graphic array,  
  50.     PICT.  If you have eleven or more songs, you can use the up and down  
  51.     arrows to scroll around in the list.  If you haven't done any graphics  
  52.     work since running CAT, you can redisplay the previous list by hitting  
  53.     [CREV] (for "catalog review").  To exit from the catalog display, hit  
  54.     ATTN (the ON key). 
  55.  
  56.  7. The system is shipped to you in the key of C.  To change keys, hit  
  57.     either [A], [C], [Eb], [F] or [G], which you'll find beginning on the  
  58.     third menu page.     
  59.  
  60.  
  61. SYSTEM DESCRIPTION 
  62. ------------------ 
  63.  
  64. This system is very simple, as befits anything that purports to make music  
  65. with the beeper on a calculator.  There are two main programs, PLAY and  
  66. PLAYD.  The former runs at normal speed and the latter is somewhat slower,  
  67. as it displays sequentially the list position of the note or text object  
  68. currently being processed.  The programs are almost identical.  The reason  
  69. I didn't use a switch to control this display and one program is that even  
  70. the small block of IF-THEN code used to check the flag is enough to slow  
  71. the program down appreciably.  The slower the program, the larger the ratio 
  72. of the time between the notes to the notes themselves.  As it is, one can't 
  73. program really short notes properly.  You can make the beeper sound for a  
  74. short time, but you can't make the sum of this short time and the time  
  75. between one note and the other arbitrarily short.  This results in a rubato 
  76. staccato effect which is not at all pleasing.  PLAYD is mainly for  
  77. debugging new themes.  If you're not going to create your own, you might as 
  78. well purge PLAYD. 
  79.  
  80. The themes themselves are in variables with names consisting of a degree  
  81. sign (alpha-right-shift 6) followed by from one to three numeric digits.   
  82. The contents of any of these variables is either a list or a program which  
  83. when evaluated leaves a list on the stack.  The former is for simple  
  84. melodies, and the latter is for complete songs with, perhaps, an a-b-a  
  85. structure.  The a and b parts are included only once, and put together into 
  86. their final form as one long list.  See song number 7 for an example  
  87. (variable '37').  The default theme, in case you hit [PLAY] without  
  88. specifying one or specifying one that doesn't exist, is the first theme of  
  89. the fourth movement of Brahms' first symphony.  This is in variable 30, so  
  90. be sure not to delete it.  If you don't want to keep Brahms' lovely theme,  
  91. make sure you replace it with something else. 
  92.  
  93. The first element of any of these theme lists is an integer representing  
  94. the tempo.  Ideally, it is the number of duration-one notes which will be  
  95. sounded per second.  The second element is a string containing the song's  
  96. title; anything over 22 characters will be truncated.  The third and  
  97. subsequent elements are notes and optional text strings to be displayed  
  98. below the title when they are encountered as the song is playing.   
  99.  
  100. The notes consist of a pitch value, which is an integer from 1 to 29  
  101. (representing almost two and a half octaves), and an optional duration.  If 
  102. the note is a scaler, it's duration is assumed to be one.  If it's complex, 
  103. the real part is the pitch value and the imaginary part is the duration.   
  104. In either case, if the pitch value is 0, the note is a rest (it pauses for  
  105. the duration value but produces no sound).  For example, if we're in the  
  106. key of C, and you want a tempo of three quarter notes per second, the title 
  107. of the song is "Blumphwitz Schnorg", and it consists of a half note middle  
  108. C followed by quarter notes E and G above middle C then eighth notes B and  
  109. D and finally a dotted half note C above middle C, you'd code it like this: 
  110. { 3 "Blumphwitz Schnorg" (1,2) 5 8 (12,.5) (15,.5) (13,3) }.  If all of  
  111. this seems confusing, look at the eleven examples and play around with your 
  112. own.  You'll discover that the timing is more difficult than my example  
  113. since the slowness of the calculator and interpreter makes short notes and  
  114. rests take longer than they should as I explained above.   
  115.  
  116. The absolute pitch values are found in an array called SCAL, which is  
  117. generated when you change keys by program SC.  The key changing programs A, 
  118. C, Eb, F, and G simply stuff a starting value and key name into the list  
  119. called ORIGIN, call SC to create the scale on the stack, and store it in  
  120. SCAL.  If you want to use a scale starting at an arbitrary frequency, just  
  121. save this starting frequency in ORIGIN (it doesn't have to be a list), hit  
  122. [SC] and store the result in SCAL by hitting left-shift-[SCAL].  You can  
  123. determine a proper scale starting value by using one of the existing  
  124. programs to establish a scale and then examining SCAL and counting up until 
  125. you find the note you want.  You can then model a scale changing program on 
  126. mine using the new origin value.  I should mention at this point, in case  
  127. you notice, that my Eb (for E-flat) doesn't use a lower case b for the flat 
  128. sign, but some obscure symbol (169 CHR) which might be an old english  
  129. thorn; it looks more like a flat symbol.  The last thing to mention is  
  130. variable DUR.  You can change this to speed-up or slow-down all tempos  
  131. without modifying the tempo elements in all of the theme lists.  It is  
  132. shipped with a value of .2.  Larger values will slow the tempos and vice  
  133. versa.   
  134.  
  135. Good luck with this system.  If you want to discuss it, or wish to  
  136. contribute any of your own themes, you can call me at (201) 455-0362 or  
  137. leave a note and/or attachment for downloading on the HP Calculator  
  138. Bulletin Board. 
  139.                                                    Jeff Broido 
  140.